// ******************************************************************
// * Copyright(c)  Steven Lu
// * Description   : Entity_PUR_PRODUCT_PURCHASE
// * CreateDate    : 2011/8/16 10:16:41
// * Creater       : CodeSmith
// * LastChangeDate: 2011/8/16 10:16:41
// * LastChanger   : 2011/8/16 10:16:41
// * Version Info  : 1.0 For ESOL
// ******************************************************************

using System;
using System.Data;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Suzsoft.Smart.Data;
using ESOL.Common.Entity;

namespace ESOL.Business.Pur
{
/// <summary>
    /// PurProductPurchase
    /// </summary>
    public partial class PurProductPurchaseBs
    {
        #region GetByID
        /// <summary>
        /// Get Entity
        /// </summary>
        /// <param name="objPurProductPurchaseEntity">Entity</param>
        /// <returns>Entity</returns>
        public static PurProductPurchaseEntity GetPurProductPurchase(PurProductPurchaseEntity objPurProductPurchaseEntity)
        {
            return DataAccess.SelectSingle<PurProductPurchaseEntity>(objPurProductPurchaseEntity);
        }

        public static List<ProdPlanOrderEntity> GetProdPlanOrderByApplicationID(string appId)
        {
            if (string.IsNullOrEmpty(appId))
            {
                return null;
            }
            string sql = @"SELECT PPO.*
                            FROM PROD_PLAN_ORDER PPO
                            INNER JOIN PUR_PRODUCT_PURCHASE PPP ON PPP.PLAN_ORDER_ID = PPO.PLAN_ORDER_ID
                            WHERE PPP.APPLICATION_ID = '" + appId + "'";
            return DataAccess.Select<ProdPlanOrderEntity>(sql);
        }
        #endregion

        #region Insert
        /// <summary>
        /// Insert Data
        /// </summary>
        /// <param name="objPurProductPurchaseEntity">Entity</param>
        /// <returns>true Insert Succeed; false Insert Fail</returns>
        public static bool InsertPurProductPurchase(PurProductPurchaseEntity objPurProductPurchaseEntity)
        {
            return DataAccess.Insert(objPurProductPurchaseEntity);
        }

        public static bool InsertPurProductPurchase(List<PurProductPurchaseEntity> objPurProductPurchaseEntityList)
        {
            return DataAccess.Insert(objPurProductPurchaseEntityList);
        }
        #endregion

        #region Update
        /// <summary>
        /// Update Data
        /// </summary>
        /// <param name="objPurProductPurchaseEntity">Entity</param>
        /// <returns>true Update Succeed; false Update Fail</returns>
        public static bool UpdatePurProductPurchase(PurProductPurchaseEntity objPurProductPurchaseEntity)
        {
            return DataAccess.Update(objPurProductPurchaseEntity);
        }

        public static bool UpdatePurProductPurchase(List<PurProductPurchaseEntity> objPurProductPurchaseEntityList)
        {
            return DataAccess.Update<PurProductPurchaseEntity>(objPurProductPurchaseEntityList);
        }
        #endregion

        #region Delete
        /// <summary>
        /// Delete Data
        /// </summary>
        /// <param name="objPurProductPurchaseEntity">Entity</param>
        /// <returns>true Delete Succeed; false Delete Fail</returns>
        public static bool DeletePurProductPurchase(PurProductPurchaseEntity objPurProductPurchaseEntity)
        {
            return DataAccess.Delete(objPurProductPurchaseEntity);
        }

        public static bool DeletePurProductPurchase(List<PurProductPurchaseEntity> objPurProductPurchaseEntityList)
        {
            return DataAccess.Delete<PurProductPurchaseEntity>(objPurProductPurchaseEntityList);
        }
        #endregion

        #region GetAll
        /// <summary>
        /// Get All Data
        /// </summary>
        /// <returns>Back All Data<returns>
        public static DataSet GetPurProductPurchaseAll()
        {
            return DataAccess.SelectAllDataSet<PurProductPurchaseEntity>();
        }
        /// <summary>
        /// Get All Data List
        /// </summary>
        /// <returns>Back All Data List<returns>
        public static List<PurProductPurchaseEntity> GetPurProductPurchaseAllList()
        {
            return DataAccess.SelectAll<PurProductPurchaseEntity>();
        }
        #endregion
	}
	
	
}	

